package com.xinke.module.system.mapper.sms;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.sms.SmsCodeDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.sms.*;

/**
 * 手机验证码 Mapper
 *
 * @author yzx
 */
@Mapper
public interface SmsCodeMapper extends BaseMapperExt<SmsCodeDO> {

    default PageResult<SmsCodeDO> selectPage(SmsCodePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<SmsCodeDO>()
                .eqIfPresent(SmsCodeDO::getSmsMobile, reqVO.getSmsMobile())
                .eqIfPresent(SmsCodeDO::getSmsCode, reqVO.getSmsCode())
                .eqIfPresent(SmsCodeDO::getCreateIp, reqVO.getCreateIp())
                .eqIfPresent(SmsCodeDO::getSendScene, reqVO.getSendScene())
                .eqIfPresent(SmsCodeDO::getTodayIndex, reqVO.getTodayIndex())
                .eqIfPresent(SmsCodeDO::getSmsUsed, reqVO.getSmsUsed())
                .betweenIfPresent(SmsCodeDO::getUsedTime, reqVO.getUsedTime())
                .eqIfPresent(SmsCodeDO::getUsedIp, reqVO.getUsedIp())
                .orderByDesc(SmsCodeDO::getSmsId));
    }

}